package com.example.oop.demo04;

public class Student {
    private String name;
    private int id;
    private int sex;
    private int age;

    //get 获得这个数据
    public String getName(){
        return this.name;
    }

    //set 给数据设置值
    public void setName(String name){
        this.name=name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age>120||age<0){
            this.age=3;
        }else{
            this.age=age;
        }
    }
}
